﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using AvantGameMachine.Graphics.InternalObjects;
using AvantGameMachine.Graphics;
using AvantGameMachine.Menu;

namespace AvantGameMachine.States.InternalObjects
{
    internal class SystemStatesProvider : StatesProvider
    {
        private SystemLoader sl;

        internal SystemStatesProvider()
        {
        }

        public override void EnterState(string _newState)
        {
            base.EnterState(_newState);
            switch (_newState)
            {
                case "SystemStart":
                    sl = AGMPlatform.SystemCamera.CreateNew2DObject<SystemLoader>("BackgroundLoader");
                    sl.LoadBasic();
                    sl.Start();
                    break;
                case "MenuState":
                    AGMPlatform.StManager.RegisterStateProvider(new MenuStatesProvider(), "LoadMenu");
                    break;
            }
        }

        public override void Update(string _currentState)
        {
            base.Update(_currentState);
            switch (_currentState)
            {
                case "SystemStart":
                    if (sl.IsLoadingFinish)
                    {
                        sl.Dispose();
                        this.ChangeState("MenuState");
                    }
                    break;
            }
        }
    }
}
